using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Threading;
using MEA.AE_Data;
using MEA.AE_Data.Access;
using MEA.AE_Data.Config;

namespace MEA.AE_BusinessLogic
{
	public class LiveView
	{
		public delegate void AddConsoleHandler(string s, Color c, string AB);

		private enum ELiveViewRecordStat
		{
			eNotRun,
			eRun,
			eWait,
			eStop
		}

		private class CLiveViewRecordStat
		{
			public ELiveViewRecordStat liveViewRecordStat;
		}

		private ConfigData.e_ECUID ab;

		private BaseService baseservice;

		private int autoSaveInterval_ms;

		private List<LogSignalLiveView> recordSignals;

		private List<ConfigLiveView.LiveViewVirtualSig> recordVirtSignals;

		private Timer recordTimer;

		private Timer AutoSaveTimer;

		private Thread th_liveview;

		private Thread th_ECUQuery;

		private int recordInterval_ms;

		private bool recordingActive;

		private DateTime recordStartTime;

		private Xml_Log xmlLog;

		private List<byte> sendList;

		private ConcurrentQueue<List<float>> saveQueue;

		private List<List<float>> samples;

		public List<Var> listECUVars;

		private byte data = 20;

		public Engine12 liveViewEngine;

		public UIGraphLiveView uigrphWin;

		private CLiveViewRecordStat cliveViewRecordStat = new CLiveViewRecordStat();

		private Stopwatch liveViewWatch = new Stopwatch();

		private bool showCACROk = true;

		public ConfigData.e_ECUID AB
		{
			get
			{
				return ab;
			}
		}

		public bool RecordingActive
		{
			get
			{
				return recordingActive;
			}
		}

		public Xml_Log XmlLog
		{
			get
			{
				return xmlLog;
			}
			set
			{
				xmlLog = value;
			}
		}

		public int AutoSaveInterval_ms
		{
			get
			{
				return autoSaveInterval_ms;
			}
			set
			{
				if (value > 0 && value < 3000)
				{
					autoSaveInterval_ms = value;
					return;
				}
				throw new Exception("AutoSaveInterval out of range");
			}
		}

		public int RecordInterval_ms
		{
			get
			{
				return recordInterval_ms;
			}
			set
			{
				if (value > 0 && value <= 3000)
				{
					recordInterval_ms = value / 100 * 100;
					return;
				}
				throw new Exception("RecordInterval out of range 100-3000");
			}
		}

		public event AddConsoleHandler ev_AddConsoleEvent;

		public event EventHandler ev_LiveViewRecordStopped;

		public event EventHandler ev_LiveViewRecordError;

		public event EventhandlerBool ev_RedrawGraph;

		public event EventHandler ev_UpdateData;

		public event EventhandlerBool ev_ButtonRecordEnabled;

		public event EventhandlerBool ev_ButtonStopEnabled;

		public event EventhandlerBool ev_ButtonShiftEnabled;

		public event AddVarDelegate ev_NewVar;

		public LiveView(BaseService baseservice)
		{
			ab = baseservice.EcuId;
			this.baseservice = baseservice;
			sendList = new List<byte>();
			recordingActive = false;
			recordSignals = new List<LogSignalLiveView>();
			recordVirtSignals = new List<ConfigLiveView.LiveViewVirtualSig>();
			saveQueue = new ConcurrentQueue<List<float>>();
			samples = new List<List<float>>();
			listECUVars = new List<Var>();
			autoSaveInterval_ms = 1000;
			recordInterval_ms = 100;
		}

		private void LiveViewEventhandlerCheck()
		{
			if (this.ev_AddConsoleEvent == null)
			{
				Console.WriteLine(string.Concat("LiveView-ev_ProcessFinished ev_ClearGraph of ECU ", ab, " has not been assigned"));
			}
			if (this.ev_LiveViewRecordError == null)
			{
				Console.WriteLine(string.Concat("LiveView-ev_ProcessFinished RecordErrorEvent of ECU ", ab, " has not been assigned"));
			}
			if (this.ev_LiveViewRecordStopped == null)
			{
				Console.WriteLine(string.Concat("LiveView-ev_ProcessFinished RecordStoppedEvent of ECU ", ab, " has not been assigned"));
			}
		}

		private void RecordStart()
		{
			try
			{
				uigrphWin.ClearAllPoints(this, null);
				foreach (LogSignalLiveView recordSignal in recordSignals)
				{
					recordSignal.SigValues.Clear();
				}
				samples.Clear();
				uigrphWin.listViewCurrentValueEnabled(true);
				uigrphWin.toolStripButtonStopEnabled(true);
				uigrphWin.RedrawAll(true);
				ECUClearSignalConfig();
				ECUWriteSignalConfig();
				AutoSaveStart();
				if (recordSignals.Count > 0)
				{
					if (ab == ConfigData.e_ECUID.A)
					{
						recordTimer = new Timer(LiveViewRecordStart, null, 1000, -1);
					}
					else if (ab == ConfigData.e_ECUID.B)
					{
						recordTimer = new Timer(LiveViewRecordStart, null, 1035, -1);
					}
					recordStartTime = DateTime.UtcNow.AddSeconds(1.0);
				}
			}
			catch (Exception ex)
			{
				try
				{
					if (this.ev_LiveViewRecordError != null)
					{
						this.ev_LiveViewRecordError("Record-Start:\r\r\n" + ex.Message, null);
					}
				}
				catch
				{
				}
			}
		}

		public void RecordStop()
		{
			TH_Abort(this, null);
			recordingActive = false;
			th_liveview = new Thread(TH_AutoSave);
			th_liveview.Name = "TH_AutoSave";
			th_liveview.Start();
			th_liveview = new Thread(TH_ECUModeReset);
			th_liveview.Name = "TH_ECUModeReset";
			th_liveview.Start();
			try
			{
				if (this.ev_ButtonRecordEnabled != null)
				{
					this.ev_ButtonRecordEnabled(true);
				}
				if (this.ev_ButtonStopEnabled != null)
				{
					this.ev_ButtonStopEnabled(false);
				}
				if (this.ev_ButtonShiftEnabled != null)
				{
					this.ev_ButtonShiftEnabled(true);
				}
				if (this.ev_RedrawGraph != null)
				{
					this.ev_RedrawGraph(false);
				}
			}
			catch
			{
			}
		}

		private void AutoSaveStart()
		{
			if (ab == ConfigData.e_ECUID.A)
			{
				AutoSaveTimer = new Timer(TH_AutoSave, null, 1300, autoSaveInterval_ms);
			}
			else
			{
				AutoSaveTimer = new Timer(TH_AutoSave, null, 1800, autoSaveInterval_ms);
			}
		}

		private void THLiveViewQuery(object v)
		{
			bool flag = true;
			long num = 0L;
			long num2 = recordInterval_ms;
			int num3 = 0;
			cliveViewRecordStat.liveViewRecordStat = ELiveViewRecordStat.eRun;
			liveViewWatch = Stopwatch.StartNew();
			List<byte> recBytes = new List<byte>(255);
			baseservice.TesterPresentHalt();
			while (flag)
			{
				num = liveViewWatch.ElapsedMilliseconds;
				lock (cliveViewRecordStat)
				{
					if (num >= num2)
					{
						cliveViewRecordStat.liveViewRecordStat = ELiveViewRecordStat.eRun;
						num2 += recordInterval_ms;
					}
				}
				switch (cliveViewRecordStat.liveViewRecordStat)
				{
				case ELiveViewRecordStat.eNotRun:
				case ELiveViewRecordStat.eStop:
					flag = false;
					break;
				case ELiveViewRecordStat.eRun:
					lock (cliveViewRecordStat)
					{
						cliveViewRecordStat.liveViewRecordStat = ELiveViewRecordStat.eWait;
					}
					recBytes.Clear();
					sendList.Clear();
					try
					{
						recBytes = baseservice.AuxService(ConfigKWP.e_kwpServices.LiveView_Sample_Read, new List<byte>());
						if (recBytes != null && recBytes[0] == 97)
						{
							SignalDecode(ref recBytes);
							num3 = 0;
						}
					}
					catch (ECUSendErrorException)
					{
						if (this.ev_AddConsoleEvent != null)
						{
							this.ev_AddConsoleEvent("Read Live View: Unable to send request", Color.Black, "ECU " + ConfigData.ECUString[(int)ab] + ":  ");
						}
						baseservice.TesterPresentStart(ConfigData.TesterPresentPeriod_ms);
						return;
					}
					catch (ECUResponseTimeoutException)
					{
						if (this.ev_AddConsoleEvent != null)
						{
							this.ev_AddConsoleEvent("Timeout error", Color.Black, "ECU " + ConfigData.ECUString[(int)AB] + ":  ");
						}
						if (num3++ > 1)
						{
							flag = false;
							Console.WriteLine("{1}: Timeout error; nErr ={0}", num3, AB);
						}
						else
						{
							Console.WriteLine("{1}: Timeout error; nErr ={0}", num3, AB);
						}
					}
					catch (ECUResponseNegativeException ex3)
					{
						baseservice.ErrorReportNegResponse(Convert.ToByte(ex3.Message));
						if (num3++ > 1)
						{
							flag = false;
							Console.WriteLine("{1}: MEA.AE_Data.Access.ECUResponseNegativeException; nErr ={0}", num3, AB);
						}
						else
						{
							Console.WriteLine("{1}: MEA.AE_Data.Access.ECUResponseNegativeException; nErr ={0}", num3, AB);
						}
					}
					catch (ECUResponseUnkownException)
					{
						if (this.ev_AddConsoleEvent != null)
						{
							this.ev_AddConsoleEvent("{1}: Unknown Response", Color.Black, "ECU " + ConfigData.ECUString[(int)AB] + ":  ");
						}
						if (num3++ > 1)
						{
							flag = false;
							Console.WriteLine("{1}: Unknown Response; nErr ={0}", num3, AB);
						}
						else
						{
							Console.WriteLine("{1}: Unknown Response; nErr ={0}", num3, AB);
						}
					}
					catch (ECUDisconnectedExeption)
					{
						if (num3++ > 1)
						{
							flag = false;
							Console.WriteLine("{1}: MEA.AE_Data.Access.ECUDisconnectedExeption; nErr ={0}", num3, AB);
						}
						else
						{
							Console.WriteLine("{1}: MEA.AE_Data.Access.ECUDisconnectedExeption; nErr ={0}", num3, AB);
						}
					}
					break;
				case ELiveViewRecordStat.eWait:
					Thread.Sleep(1);
					break;
				}
			}
			lock (cliveViewRecordStat)
			{
				cliveViewRecordStat.liveViewRecordStat = ELiveViewRecordStat.eNotRun;
			}
			liveViewWatch.Stop();
			baseservice.TesterPresentStart(ConfigData.TesterPresentPeriod_ms);
		}

		public void FileLoadXML(ref List<List<float>> samplesXML, DateTime recordStartTime, ref UIGraphWindow uiGrp)
		{
			this.recordStartTime = recordStartTime;
			samples.Clear();
			int count = samplesXML.Count;
			for (int i = 0; i < count; i++)
			{
				List<float> sigValues = samplesXML[i];
				AddToGraph(ref sigValues);
				samples.Add(sigValues);
				uiGrp.UiGraph1.UpdateData(null, null);
			}
		}

		private void AddToGraph(ref List<float> sigValues)
		{
			for (int i = 0; i < sigValues.Count; i++)
			{
				Var var = listECUVars[i];
				var.Addpoint(recordStartTime, recordInterval_ms, sigValues[i]);
			}
		}

		public void SignalAdd(ref LogSignalLiveView signal)
		{
			if (signal != null)
			{
				Var var = new Var(ref signal, string.Format("{0}: {1}", ab, signal.description));
				recordSignals.Add(signal);
				var.LineColor = signal.color;
				var.Ecu_message = signal.Ecu_Message;
				listECUVars.Add(var);
				return;
			}
			throw new Exception("LogSignalLiveView instance not set when adding to LiveView-Object");
		}

		public void SignalAddSet()
		{
			if (this.ev_NewVar != null)
			{
				this.ev_NewVar(null);
			}
		}

		public void VirtualSigAdd(ref ConfigLiveView.LiveViewVirtualSig vSignal)
		{
			recordVirtSignals.Add(vSignal);
		}

		public void SignalRemove(LogSignalLiveView signal)
		{
			throw new NotImplementedException();
		}

		public void SignalClearAll()
		{
			throw new NotImplementedException();
		}

		public void ButtonRecordPressed_Handler(Engine12 engine, UIGraphLiveView uigrphwin)
		{
			LiveViewEventhandlerCheck();
			uigrphWin = uigrphwin;
			liveViewEngine = engine;
			ev_UpdateData += uigrphWin.UpdateData;
			if (!recordingActive)
			{
				recordingActive = true;
				th_liveview = new Thread(RecordStart);
				th_liveview.Name = "RecordStart";
				th_liveview.Start();
			}
		}

		public void ButtonSavePressed_Handler(object logpath, ArrayList functs)
		{
			throw new NotImplementedException();
		}

		public void ButtonStopPressed_Handler(object sende, EventArgs e)
		{
			LiveViewEventhandlerCheck();
			if (recordingActive)
			{
				RecordStop();
			}
		}

		private void ECUWriteSignalConfig()
		{
			new List<byte>();
			baseservice.TesterPresentHalt();
			try
			{
				if (this.ev_AddConsoleEvent != null)
				{
					this.ev_AddConsoleEvent("Writing Live View data config", Color.Black, string.Concat("ECU ", ab, ":  "));
				}
			}
			catch
			{
			}
			sendList.Clear();
			int num = 1;
			for (int i = 0; i < recordSignals.Count; i++)
			{
				LogSignalLiveView logSignalLiveView = recordSignals[i];
				if (!logSignalLiveView.IsSignalVirtual)
				{
					sendList.Add(3);
					sendList.Add((byte)num);
					num += logSignalLiveView.MemSize;
					sendList.Add((byte)logSignalLiveView.MemSize);
					sendList.AddRange(logSignalLiveView.Address);
				}
			}
			try
			{
				baseservice.AuxService(ConfigKWP.e_kwpServices.LiveView_Config_Write, sendList);
				if (this.ev_AddConsoleEvent != null)
				{
					this.ev_AddConsoleEvent("Live View signals configured", Color.Black, string.Concat("ECU ", ab, ":  "));
				}
			}
			catch (ECUSendErrorException)
			{
				if (this.ev_AddConsoleEvent != null)
				{
					this.ev_AddConsoleEvent("Write Live View Config: Unable to send request", Color.Black, string.Concat("ECU ", ab, ":  "));
				}
				baseservice.TesterPresentStart(ConfigData.TesterPresentPeriod_ms);
				return;
			}
			catch (ECUResponseTimeoutException)
			{
				if (this.ev_AddConsoleEvent != null)
				{
					this.ev_AddConsoleEvent("Timeout error", Color.Black, string.Concat("ECU ", AB, ":  "));
				}
				return;
			}
			catch (ECUResponseNegativeException ex3)
			{
				baseservice.ErrorReportNegResponse(Convert.ToByte(ex3.Message));
			}
			catch (ECUResponseUnkownException)
			{
				if (this.ev_AddConsoleEvent != null)
				{
					this.ev_AddConsoleEvent("Unknown Response", Color.Black, string.Concat("ECU ", ab, ":  "));
				}
			}
			catch (ECUDisconnectedExeption)
			{
			}
			baseservice.TesterPresentStart(ConfigData.TesterPresentPeriod_ms);
		}

		private void ECUClearSignalConfig()
		{
			new List<byte>();
			baseservice.TesterPresentHalt();
			baseservice.Diagnose_stop();
			baseservice.Diagnose_start(134u);
			try
			{
				if (this.ev_AddConsoleEvent != null)
				{
					this.ev_AddConsoleEvent("Clearing temporary data packet configuration", Color.Black, string.Concat("ECU ", ab, ":  "));
				}
			}
			catch
			{
			}
			sendList.Clear();
			try
			{
				baseservice.AuxService(ConfigKWP.e_kwpServices.LiveView_Config_Clear, sendList);
				if (this.ev_AddConsoleEvent != null)
				{
					this.ev_AddConsoleEvent("data packet config cleared", Color.Black, string.Concat("ECU ", ab, ":  "));
				}
			}
			catch (ECUSendErrorException)
			{
				if (this.ev_AddConsoleEvent != null)
				{
					this.ev_AddConsoleEvent("Clearing temp. data packet configuration: Unable to send request", Color.Black, string.Concat("ECU ", ab, ":  "));
				}
				baseservice.TesterPresentStart(ConfigData.TesterPresentPeriod_ms);
				return;
			}
			catch (ECUResponseTimeoutException)
			{
				if (this.ev_AddConsoleEvent != null)
				{
					this.ev_AddConsoleEvent("Timeout error", Color.Black, string.Concat("ECU ", AB, ":  "));
				}
				return;
			}
			catch (ECUResponseNegativeException ex3)
			{
				baseservice.ErrorReportNegResponse(Convert.ToByte(ex3.Message));
			}
			catch (ECUResponseUnkownException)
			{
				if (this.ev_AddConsoleEvent != null)
				{
					this.ev_AddConsoleEvent("Unknown Response", Color.Black, string.Concat("ECU ", ab, ":  "));
				}
			}
			catch (ECUDisconnectedExeption)
			{
			}
			baseservice.TesterPresentStart(ConfigData.TesterPresentPeriod_ms);
		}

		private void LiveViewRecordStart(object ob)
		{
			switch (cliveViewRecordStat.liveViewRecordStat)
			{
			case ELiveViewRecordStat.eNotRun:
				th_ECUQuery = new Thread(THLiveViewQuery);
				th_ECUQuery.Start(null);
				th_ECUQuery.Name = "ECUQuery";
				th_ECUQuery.Priority = ThreadPriority.Highest;
				break;
			case ELiveViewRecordStat.eRun:
			case ELiveViewRecordStat.eWait:
				this.ev_AddConsoleEvent("Timeout error: Live View thread not finisched", Color.Black, "ECU " + ConfigData.ECUString[(int)AB] + ":  ");
				break;
			}
		}

		private void LiveViewRecordStop()
		{
			lock (cliveViewRecordStat)
			{
				switch (cliveViewRecordStat.liveViewRecordStat)
				{
				case ELiveViewRecordStat.eRun:
				case ELiveViewRecordStat.eWait:
					cliveViewRecordStat.liveViewRecordStat = ELiveViewRecordStat.eStop;
					break;
				}
			}
		}

		private void TH_AutoSave(object ob)
		{
			string AB = ConfigData.ECUString[(int)ab];
			while (!saveQueue.IsEmpty)
			{
				List<float> result;
				if (saveQueue.TryDequeue(out result))
				{
					lock (xmlLog)
					{
						xmlLog.SaveLiveViewSample(ref result, ref AB);
					}
				}
			}
		}

		private void TH_ECUModeReset()
		{
			try
			{
				baseservice.Diagnose_stop();
				baseservice.Diagnose_start(ConfigKWP.DiagMode_Get(ConfigKWP.e_DiagModes.Diagnostic));
			}
			catch (ECUDisconnectedExeption)
			{
			}
		}

		private void SignalDecode(ref List<byte> recBytes)
		{
			int num = 0;
			int count = recordSignals.Count;
			List<float> sigValues = new List<float>(new float[count]);
			foreach (LogSignalLiveView recordSignal in recordSignals)
			{
				if (!recordSignal.IsSignalVirtual)
				{
					num += recordSignal.MemSize;
				}
			}
			if (recBytes.Count < num + 2)
			{
				if (this.ev_AddConsoleEvent != null)
				{
					this.ev_AddConsoleEvent("Error during decoding of signal data, missed sample!", Color.Black, string.Concat("ECU ", ab, ":  "));
				}
				return;
			}
			int num2 = 2;
			int num3 = 0;
			float num4 = 0f;
			try
			{
				for (int i = 0; i < count; i++)
				{
					LogSignalLiveView logSignalLiveView = recordSignals[i];
					if (!logSignalLiveView.IsSignalVirtual)
					{
						switch (logSignalLiveView.SigType)
						{
						case ConfigBase.EDataType.e_u8:
							num4 = (int)recBytes[num2];
							num2++;
							break;
						case ConfigBase.EDataType.e_s8:
							num4 = (sbyte)recBytes[num2];
							num2++;
							break;
						case ConfigBase.EDataType.e_u16:
							num4 = (int)(ushort)((recBytes[num2] << 8) + recBytes[num2 + 1]);
							num2 += 2;
							break;
						case ConfigBase.EDataType.e_s16:
							num4 = (short)((recBytes[num2] << 8) + recBytes[num2 + 1]);
							num2 += 2;
							break;
						case ConfigBase.EDataType.e_u32:
							num4 = (uint)((recBytes[num2] << 24) + (recBytes[num2 + 1] << 16) + (recBytes[num2 + 2] << 8) + recBytes[num2 + 3]);
							num2 += 4;
							break;
						case ConfigBase.EDataType.e_s32:
							num4 = (recBytes[num2] << 24) + (recBytes[num2 + 1] << 16) + (recBytes[num2 + 2] << 8) + recBytes[num2 + 3];
							num2 += 4;
							break;
						default:
							num2++;
							break;
						}
						ConfigLiveViewBase.SLiveViewSigClass sLiveViewSigClass = ConfigLiveView.SigClass[(int)logSignalLiveView.sigClass];
						sigValues[i] = sLiveViewSigClass.getVal(num4);
					}
				}
				for (int i = 0; i < count; i++)
				{
					LogSignalLiveView logSignalLiveView = recordSignals[i];
					if (!logSignalLiveView.IsSignalVirtual)
					{
						continue;
					}
					ConfigLiveView.LiveViewVirtualSig liveViewVirtualSig = recordVirtSignals[num3];
					switch (recordVirtSignals[num3].sigOperator)
					{
					case ConfigLiveView.ESignalOperator.e_SigDiff:
						num4 = sigValues[liveViewVirtualSig.sigNr1];
						num4 -= sigValues[liveViewVirtualSig.sigNr2];
						if (logSignalLiveView.ECU_EMesage != ConfigLiveView.ESignals.e_CaSCrS_phiDiff)
						{
						}
						break;
					case ConfigLiveView.ESignalOperator.e_SigSumme:
						num4 = sigValues[recordVirtSignals[num3].sigNr1];
						num4 += sigValues[recordVirtSignals[num3].sigNr2];
						break;
					case ConfigLiveView.ESignalOperator.e_SigReadVal:
						switch (recordVirtSignals[num3].virtualSignalSigNr)
						{
						case 169:
							num4 = (float)liveViewEngine.PropSpeed;
							break;
						case 167:
							num4 = (float)liveViewEngine.OilPress;
							break;
						case 168:
							num4 = (float)liveViewEngine.OilTemp;
							break;
						case 161:
							num4 = (float)liveViewEngine.CoolTemp;
							break;
						case 166:
							num4 = (float)liveViewEngine.GearboxOilTemp;
							break;
						case 160:
							num4 = liveViewEngine.CautioLampWert;
							break;
						case 165:
							num4 = liveViewEngine.FuelPressWarnWert;
							break;
						case 162:
							num4 = (int)liveViewEngine.EcuStatusWert;
							break;
						case 170:
							num4 = liveViewEngine.VoterOutputWert;
							break;
						case 159:
							num4 = (float)liveViewEngine.BatVolt;
							break;
						case 163:
							num4 = (float)liveViewEngine.EngPerf;
							break;
						case 164:
							num4 = (float)liveViewEngine.FuelFlow;
							break;
						case 171:
							num4 = (float)liveViewEngine.OilLevel;
							break;
						}
						break;
					}
					sigValues[i] = num4;
					num3++;
				}
			}
			catch
			{
				if (this.ev_AddConsoleEvent != null)
				{
					this.ev_AddConsoleEvent("Error during decoding of signal data, missed sample!", Color.Black, string.Concat("ECU ", ab, ":  "));
				}
			}
			if (sigValues.Count > 0)
			{
				AddToGraph(ref sigValues);
				saveQueue.Enqueue(sigValues);
				lock (samples)
				{
					samples.Add(sigValues);
				}
				uigrphWin.UpdateData(null, null);
			}
		}

		public void Window_closed_Handler(object sender, EventArgs e)
		{
			if (recordingActive)
			{
				RecordStop();
			}
		}

		private void TH_Abort(object sender, EventArgs e)
		{
			LiveViewRecordStop();
			try
			{
				th_liveview.Abort();
			}
			catch
			{
				Console.WriteLine("TH_Abort 1\n");
			}
			try
			{
				AutoSaveTimer.Dispose();
			}
			catch
			{
				Console.WriteLine("TH_Abort 2\n");
			}
			try
			{
				recordTimer.Dispose();
			}
			catch
			{
				Console.WriteLine("TH_Abort 3\n");
			}
		}

		public string FileExportINCA_SigDefNames(string delimiter)
		{
			string text = "";
			for (int i = 0; i < recordSignals.Count; i++)
			{
				if (i == 0)
				{
					text = recordSignals[i].Ecu_Message + "\\ECU-" + ab;
					continue;
				}
				object obj = text;
				text = string.Concat(obj, delimiter, recordSignals[i].Ecu_Message, "\\ECU-", ab);
			}
			return text;
		}

		public string FileExportINCA_SigDefUnits(string delimiter)
		{
			string text = "";
			for (int i = 0; i < recordSignals.Count; i++)
			{
				text = ((i != 0) ? (text + delimiter + string.Format("\"{0}\"", ConfigLiveView.SigClass[(int)recordSignals[i].sigClass].Unit)) : string.Format("\"{0}\"", ConfigLiveView.SigClass[(int)recordSignals[i].sigClass].Unit));
			}
			return text;
		}

		public string FileExportINCA_SigDefTypes(string delimiter)
		{
			string text = "";
			foreach (LogSignalLiveView recordSignal in recordSignals)
			{
				text = text + delimiter + recordSignal.getLiveViewType();
			}
			return text;
		}

		public List<List<float>> FileExportINCA_Samples(string delimiter)
		{
			return samples;
		}
	}
}
